package com.heima.App;

import com.heima.dao.Brand;
import com.heima.pojo.Person;
import com.heima.service.PersonService;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class AppPerson {
    public static void main( String[] args ) {
        ClassPathXmlApplicationContext ctx =
                new ClassPathXmlApplicationContext("applicationContext-Person.xml");

        PersonService personService = (PersonService) ctx.getBean("personService");
        personService.save();
        //注册关闭钩子函数，在虚拟机退出之前回调此函数，关闭容器
        ctx.registerShutdownHook();
        //关闭容器
        //ctx.close();
    }
}
